@REM @Author: CPS
@REM @Date:   2020-09-15 10:15:59
@REM @Last Modified by:   Administrator
@REM Modified time: 2020-09-15 11:01:16
@echo off

::==================通过U盘的卷名监测是否已插入U盘==================
rem @set "cpsUname=CPS_TOOL"
rem @set "cpsUP=无U盘"
rem @for %%i in (e f g h i j k l m n o p q r s t u v) do (
rem     echo 识别U盘[%cpsUname%]中...&vol %%i:|find /i "%cpsUname%">nul&&set "cpsUP=%%i:"&cls
rem     )
rem @if "%cpsUP%"=="无U盘" (echo 合法的U盘 & pasue & exit)


::==================用户设置==================================================
::初始化变量
set "bookMaskPath=None"
set "userName="

::设置保存路径
set "bkPath=%~dp0bookmarks"


::==================配置电脑名==================================================
::设置电脑名，和对应的bookmask路径
@if "%computername%"=="DESKTOP-S9VGC7V" (
    set "bookMaskPath=Z:\CPS\Chrome\UserData\Default\"
    )


::判断是否获取到合法路径
@if "%bookMaskPath%"=="None" (goto emptyPath)


::==================获取当前日期做文件名
@for /f "delims=/ tokens=1-3" %%a in ("%date:~0,10%") do (call set "newDate=%%a%%b%%c")
@for /f "tokens=* delims= " %%a in ("%time:~0,5%") do (for /f "tokens=1,2 delims=:" %%i in ("%%a") do (call set "newTime=%%i%%j"))
@set "resName=bookmarks_%newDate%_%newTime%"

::==================复制最新的bookmask到本路径
@set "tarPath=%bookMaskPath%Bookmarks"
@copy "%tarPath%" "%~dp0bookmarks\%resName%"

@echo %tarPath%
@echo %~dp0

:end
pause

:emptyPath
@echo bookmasks path is empty
pause